package domaine;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

@Entity
@Table(schema = "FINITO", name = "INGREDIENTS")
public class Ingredient implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2864518305986960438L;


	
	/*******************************************************/
	@Id
	@Column(name="NUM_INGREDIENT")
	@Min(1)
	@Max(12)
	private int numIngredient;
	
	@NotNull
	@Column(name="NOM_INGREDIENT")
	private String nomIngredient;
	
	protected Ingredient(){}

	public Ingredient(int numIngredient,String nomIngredient) {
		this.numIngredient = numIngredient;
		this.nomIngredient=nomIngredient;
	}

	public int getNumIngredient() {
		return numIngredient;
	}

	public String getNomIngredient() {
		return nomIngredient;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + numIngredient;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Ingredient other = (Ingredient) obj;
		if (numIngredient != other.numIngredient)
			return false;
		return true;
	}



}
